<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>圈存交易报表</title>
		<script type="text/javascript" language="javascript" src="../script/common.js"></script>
		<script type="text/javascript" language="javascript" src="../script/common_stat.js"></script>
		<script language="javascript" src="../script/core/mootools.js" type="text/javascript"></script>
		<script type="text/javascript">
			var crosstab = new Crosstab();
			
			var statForm;
			var pivot;
			function load(){
				Eui.showNavigation();
				setPages(["queryView","newPivot"]);
			
				statForm = $("statForm");
			
				statForm.orgId.value = Common.cOrg().id;
				statForm.orgLevel.value = Common.cOrg().orgLevel;
				statForm.orgName.value = Common.cOrg().name;
				CardStore.initCardStoreStat("stat_btn")
				 newPivot()
			}
			
			function newPivot(){
				var sql = "zh_load_stat";
				var crossconf = {};
				crossconf.measures = {"sum":"总金额","count":"总笔数"}
				crossconf.dimensions = {"org":{name:"受理机构",option:{"p200":"公交公司","p500":"代理机构",p700:"网点机构"}},"eftNo":"交易POS","tradeStatus":"交易状态"}
				crossconf.defaultMeasure = {sum:true,count:true};
				crossconf.defaultVertical = {};
				crossconf.defaultHorizon = {tradeStatus:false,"org":{"p200":true,"p500":true,"p700":true},"eftNo":false};
				pivot = new Pivot('newPivot',sql,null,{disableChart:true,initPivotHead:initPivotHead});
				pivot.ShowZero = true;
				pivot.initConf(crossconf);
				pivot.setPivotHead('pivotTitle','圈存交易统计');
			}
			function initPivotHead(div){
				var title = '<table width="100%" border="0" cellspacing="0" cellpadding="5" style="width:600">'
						  + '<tr><td align="center" class="reportTitle" height="50" colspan="3" id="#DIVID#_pivotTitle"></td></tr>'
						  + '<tr><td width="32%">统 计 人：<span id="#DIVID#_statOper"></span></td><td width="35%">统计机构：<span id="#DIVID#_statOrg"></span></td><td>统计时间：<span id="#DIVID#_statTime"></span></td></tr>'
						  + '<tr><td>机构名称：<span id="#DIVID#_orgName"></span></td></tr>'
						  + '<tr><td>起始时间：<span id="#DIVID#_beginDate"></span></td><td>结束时间：<span id="#DIVID#_endDate"></span></td></tr></table>';
				$(div+'_pivot_head').innerHTML = title.replace(/#DIVID#/g,div);
			}
			function doQuery(){
				CardStore.formatStatDate()
				if(!checkForm(statForm)) return;
				pivot.param = Common.getValues(statForm);
				//$$(pivot.param)
				pivot.setPivotHead('statTime',Format.today(true));
				pivot.setPivotHead('statOper',Common.cOperator().name);
				pivot.setPivotHead('statOrg',Common.cOrg().name);
				pivot.setPivotHead('orgName',pivot.param.orgName);
				pivot.setPivotHead('beginDate',pivot.param.beginDate);
				pivot.setPivotHead('endDate',pivot.param.endDate);
				switchPage('newPivot');
				pivot.refresh();
			}
			
			function resetStatForm(){
				
				statForm.orgId.value = Common.cOrg().id;
				statForm.orgLevel.value = Common.cOrg().orgLevel;
				statForm.orgName.value = Common.cOrg().name;
				switchPage('queryView');
			}
			//选择机构方法
			function setOrg(sorg) {
				var form = $("statForm")
				form.orgName.value = sorg.name;
			 	form.orgId.value = sorg.id;
				form.orgLevel.value = sorg.orgLevel;
			}
			
		</script>
	</head>

<body onload="load()">
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="queryView" class="form">
		<div class="formTitle">圈存交易统计：查询条件</div>
		<form id="statForm" name="statForm">
			<input type="hidden" name="orgId"/>
			<input type="hidden" name="orgLevel"/>
			<table width="100%" cellspacing="0" cellpadding="4" class="col3">
				<tr>
					<td><label>机构名称</label> &nbsp;&nbsp;<input type="text" name="orgName" class="readonly"> <a class="orga" href="#" onclick="SystemMgnt.selOrg(setOrg);">&nbsp;&nbsp;</a></td>
				</tr>
				<tr>
					<td id="stat_btn"><button type="button" onclick="doQuery()">查 询</button></td>
				</tr>
			</table>
		</form>
	</div>
	<!-- Flash 报表-->
	<div id="newPivot" style="display:none;"></div>
	
</body>	
</html>
